package com.ai.platform.spider.core.collocate;

import com.ai.platform.spider.utils.Properties;

/**
 * 默认的配置构建器
 *
 */
public abstract class DefaultConfBuilder implements Config.Builder {

    protected Config conf;

    public DefaultConfBuilder() {
        conf = new Config();
    }

    /**
     * 添加参数
     *
     * @param params
     */
    public abstract void configParams(Properties params);

    /**
     * 添加种子
     *
     * @param seeds
     */
    public abstract void configSeeds(Config.Seeds seeds);

    /**
     * 添加规则
     * @param rules
     */
    public abstract void configRules(Config.Rules rules);

    /**
     * 添加文档
     * @param docs
     */
    public abstract void configDocs(Config.Docs docs);

    /**
     * 构建Config对象
     */
    public Config build() {
        this.configParams(conf.getParams());
        this.configSeeds(conf.getSeeds());
        this.configRules(conf.getRules());
        this.configDocs(conf.getDocs());
        return conf;
    }

}
